﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HCFramework.API.LINQ;

namespace HCFramework.User.Role
{
    public partial class ChooseRole : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindData();
            }
        }

        public void BindData()
        {
            HCDataContext db = new HCDataContext();
            DropDownList1.DataTextField = "Name";
            DropDownList1.DataValueField = "RoleID";
            DropDownList1.DataSource = db.Roles.OrderBy(ik => ik.Name);
            DropDownList1.DataBind();
        }
    }
}